{layout name="../common/master"/}
<div id="right">
       <h4 style="border-bottom: 1px solid #ccc;padding-bottom: 3px">所有用户列表</h4>

    <form action="" method="get" role="form">
        <div class="form-group">
            <label for="">用户电话：</label>
            <input name="user_phone" {if condition="isset($_GET['user_phone'])"} value="{$_GET['user_phone']}" {/if} type="text"/>

            <label for="">性别：</label>
            <select name="gender" id="inputID" >
                <option {if condition="(isset($_GET['gender'])) AND ($_GET['gender'] eq 0)"} selected {/if} value="0" selected>全部</option>
                <option {if condition="(isset($_GET['gender'])) AND ($_GET['gender'] eq 1)"} selected {/if} value="1">男</option>
                <option {if condition="(isset($_GET['gender'])) AND ($_GET['gender'] eq 2)"} selected {/if} value="2">女</option>
            </select>
            <label for="">出生日期：</label>
            <input name="startBirth" {if condition="isset($_GET['startBirth'])"} value="{$_GET['startBirth']}" {/if} type="text" id="" onclick="WdatePicker({startDate:'1980-11-01',alwaysUseStartDate:true})"/>
            ~
            <input name="endBirth" {if condition="isset($_GET['endBirth'])"} value="{$_GET['endBirth']}" {/if} type="text" id="" onclick="WdatePicker({startDate:'2017-11-01',alwaysUseStartDate:true})"/>

            <label for="">注册时间：</label>
            <input name="signStart" {if condition="isset($_GET['signStart'])"} value="{$_GET['signStart']}" {/if} type="text" id="" onclick="WdatePicker({startDate:'2017-11-01',alwaysUseStartDate:true})"/>
            ~
            <input name="signEnd" {if condition="isset($_GET['signEnd'])"} value="{$_GET['signEnd']}" {/if} type="text" id="" onclick="WdatePicker({startDate:'2017-11-01',alwaysUseStartDate:true})"/>


            <label for="">短信审核状态：</label>
            <select name="sms_status" >
                <option {if condition="(isset($_GET['gender'])) AND ($_GET['gender'] eq 0)"} selected {/if} value="0" selected>全部</option>
                <option {if condition="(isset($_GET['gender'])) AND ($_GET['gender'] eq 0)"} selected {/if} value="0" >未查看</option>
                <option {if condition="(isset($_GET['gender'])) AND ($_GET['gender'] eq 1)"} selected {/if} value="1">审核通过</option>
                <option {if condition="(isset($_GET['gender'])) AND ($_GET['gender'] eq 2)"} selected {/if} value="2">审核不通过</option>
                <option {if condition="(isset($_GET['gender'])) AND ($_GET['gender'] eq 2)"} selected {/if} value="3">无短信</option>
            </select>
        </div>
        <button type="submit" class="btn btn-primary">查询</button>
    </form>
    <div>
    <button id="extend" type="submit" class="btn btn-info">导出到EXCEL</button>
</div>
    <table class="table-bordered table  table-hover" style="margin-top: 20px;">
        <thead>
        <tr>
            <th>序号</th>
            <th>用户名</th>
            <th>手机号</th>
            <th>注册时间</th>
            <th>用户状态</th>
            <th>短信审核状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach name="data" item="vo" key="k"}
            <tr>
                <th>{$k+1}</th>
                <th>{$vo['userName']}</th>
                <th>{$vo['userPhone']}</th>
                <th>{$vo['create_time']}</th>
                <th>{$vo['status']}</th>
                <th>
                    {if condition="$vo['admin_sms_status'] eq 1"}
                审核通过
                    {elseif condition="$vo['admin_sms_status'] eq 2"}
                 审核不通过
                    {elseif condition="$vo['admin_sms_status'] eq 3"}
                无短信
                    {else/}
                未查看
                    {/if}
                </th>
                <th>
                    <div class="btn-group">
                        <a style="margin-left: 5px" href="{:URL('home/User/userInfo',['uid'=>$vo['id']])}" class="btn btn-primary btn-xs">查看详情</a>
                        <a style="margin-left: 5px" href="{:URL('home/User/userCer',['uid'=>$vo['id'],'phoneNum'=>$vo['userPhone']])}" class="btn btn-info btn-xs">查看认证</a>
                        <a style="margin-left: 5px" href="{:URL('home/User/usercontact',['uid'=>$vo['id']])}" class="btn btn-primary btn-xs">查看通讯录</a>
                        <a style="margin-left: 5px" href="{:URL('home/User/usersms',['uid'=>$vo['id']])}" class="btn btn-info btn-xs">查看短信</a>
                        <a style="margin-left: 5px" href="{:URL('home/User/userappuse',['uid'=>$vo['id']])}" class="btn btn-primary btn-xs">查看app安装历史</a>
                        <a style="margin-left: 5px" href="{:URL('home/User/userface',['uid'=>$vo['id'],'phoneNum'=>$vo['userPhone']])}" class="btn btn-info btn-xs">人脸识别</a>
                        <button style="margin-left: 5px" phone_num="{$vo['userPhone']}" class="pushsms btn btn-success btn-xs">发送短信</button>
                    </div>
                </th>
            </tr>
        {/foreach}
        </tbody>
    </table>
    {$page} 总计用户数：{$totalCount}

</div>
<script>
    $("#extend").click(function () {
        var url="{:URL('home/User/userList',$_GET)}";
        url=url+"&extend=1";
        location.href=url;
    })
    $(".pushsms").click(function () {
        var phone_num=$(this).attr('phone_num');
                var html=`
                <form  action="" method="post" role="form">
                        <label for="">选择短信模板</label>
                        <select name="smsAppTmp" id="smsAppTmp" class="form-control">
                        <option value=""> -- Select One --</option>
                {foreach name="smsTmp" item="vo" key="k"}
            <option value="{$vo['content']}">{$vo['name']}</option>
            {/foreach}
    </select>
    </form>
    `;
    layer.open({
        btn:['推送'],
        title:'发送催款推送',
        area:['300px','300px'],
        content:html,
        yes:(function(){
            var smstmp=$("#smsAppTmp option:selected").val();
            $.post("{:URL('home/Sms/activeSendSms')}",{smstmp:smstmp,phone:phone_num},function(res){
                alert(res);
                if(res.code ==0){
                    layer.alert("success!");
                    location.reload();
                }else{
                    layer.alert(res.data);
                    location.reload();
                }
            })
        })

    })
    })
</script>
<script type="text/javascript" src="__PUBLIC__/home/tuo/DatePicker/WdatePicker.js"></script>
